﻿namespace PrimeNumber
{
    internal class Program
    {
        /// <summary>
        /// PrimeNumber
        /// </summary>
        const int N = 10000;
        static void Main(string[] args)
        {
            int i = 2;
            int j = 1;
            int max = 0;
            double rectionTime = 0;//记录查找时间
            DateTime dateTimeStart = DateTime.Now;//开始

            //寻找10000以内最大质数
            for (i = 2; i <= N; i++)
            {
                for (j = 2; j < i; j++)
                { if (i % j == 0) break; }
                if (j >= i) max = i;
            }

            DateTime dateTimeEnd = DateTime.Now;//结束
            TimeSpan s = dateTimeEnd - dateTimeStart;//耗时
            rectionTime = s.TotalSeconds;
            Console.WriteLine($"总耗时{rectionTime}秒,{N}以内最大质数为{max}");
        }

    }
}